<html>
<head><meta charset="utf-8"><title>realloc_zeroed · t-libs/wg-allocators · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/index.html">t-libs/wg-allocators</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/realloc_zeroed.html">realloc_zeroed</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="207226734"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/realloc_zeroed/near/207226734" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Peter Rabbit <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/realloc_zeroed.html#207226734">(Aug 18 2020 at 06:17)</a>:</h4>
<p>Why is there no <code>realloc_zeroed</code> and why does <code>realloc</code> make no mention of whether it zeros or not? We have <code>alloc</code> and <code>alloc_zeroed</code>. <code>HeapReAlloc</code> supports a flag to zero the extra memory, so why is this not exposed in the API?!</p>



<a name="207226916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/197181-t-libs/wg-allocators/topic/realloc_zeroed/near/207226916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tim Diekmann <a href="https://rust-lang.github.io/zulip_archive/stream/197181-t-libs/wg-allocators/topic/realloc_zeroed.html#207226916">(Aug 18 2020 at 06:21)</a>:</h4>
<p>I guess you are talking about <a href="https://doc.rust-lang.org/nightly/core/alloc/trait.GlobalAlloc.html"><code>GlobalAlloc</code></a>? <a href="https://github.com/rust-lang/wg-allocators/issues/48">The plan</a> is to deprecate <code>GlobalAlloc</code> in favor of <a href="https://doc.rust-lang.org/nightly/core/alloc/trait.AllocRef.html"><code>AllocRef</code></a>. The latter replaces <code>realloc</code> with <code>grow</code>, <code>grow_zeroed</code> and <code>shrink</code>.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>